﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListDirectorates.ascx.cs"
    Inherits="Pantry.Web.Users.Controls.ListDirectorates" %>
<%@ Register TagPrefix="CC" Namespace="SiteUtils" Assembly="CollectionPager" %>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="CollectionPager1" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="ButtonCreate" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton2" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton3" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton4" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton5" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton6" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton7" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton8" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="ButtonCreate" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonAddress" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonContactName" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonDirectorateName" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonPostcode" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonStatus" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="CheckBoxIncludeInactive" EventName="CheckedChanged" />
        <asp:AsyncPostBackTrigger ControlID="RepeaterDirectorate" EventName="ItemCommand" />
    </Triggers>
    <ContentTemplate>
        <div class="dtBottom">
            <div class="dtPagination more" style="float: left; margin-left: -15px;">
                <div class="dataTables_paginate paging_full_numbers" id="DataTables_Table_0_paginate">
                    <span>
                        <asp:LinkButton ID="LinkButton1" Text="All" runat="server" OnClick="LinkButton1Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton2" Text="0-9" runat="server" OnClick="LinkButton2Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton3" Text="A B C D E" runat="server" OnClick="LinkButton3Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton4" Text="F G H I J" runat="server" OnClick="LinkButton4Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton5" Text="K L M N" runat="server" OnClick="LinkButton5Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton6" Text="O P Q R" runat="server" OnClick="LinkButton6Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton7" Text="S T U V" runat="server" OnClick="LinkButton7Click"></asp:LinkButton></span>
                    <span>
                        <asp:LinkButton ID="LinkButton8" Text="W X Y Z" runat="server" OnClick="LinkButton8Click"></asp:LinkButton></span>
                </div>
            </div>
            <div class="active-panel">
                <asp:CheckBox ID="CheckBoxIncludeInactive" runat="server" CssClass="simple_form abc"
                    AutoPostBack="True" Checked="true" OnCheckedChanged="CheckBoxIncludeInactiveChanged" /><label
                        class="simple_form" for="CheckBoxIncludeActivate">
                        Include in-active</label>
            </div>
            <asp:Button ID="ButtonCreate" Text="Create" runat="server" OnClick="ButtonCreateClick"
                CssClass="buttonCreateDepartment" />
        </div>
        <div style="clear: both;">
        </div>
        <div class="widget_contents noPadding">
            <div class="dtTables">
                <table class="tables noObOLine dataTable">
                    <thead>
                        <tr>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonDirectorateName" OnClick="LinkButtonDepartmentNameClick">BU/Directorate Name</asp:LinkButton>
                            </th>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonAddress" OnClick="LinkButtonAddressClick">Office Address Line 1</asp:LinkButton>
                            </th>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonPostcode" OnClick="LinkButtonPostcodeClick">Postcode</asp:LinkButton>
                            </th>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonContactName" OnClick="LinkButtonContactNameClick">Contact Name</asp:LinkButton>
                            </th>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonStatus" OnClick="LinkButtonStatusClick">Is Active?</asp:LinkButton>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater runat="server" ID="RepeaterDirectorate" OnItemCommand="MarkActivated">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <asp:HiddenField runat="server" ID="HiddenDirectorateId" Value='<%# string.Format("{0}${1}", Eval("DirectorateId"), Eval("OrganizationId")) %>' />
                                        <asp:LinkButton runat="server" ID="LinkButton9" Visible='<%#Eval("Status").Equals("Yes")? true : false %>'><%#Eval("DirectorateName") %></asp:LinkButton>
                                        <asp:LinkButton runat="server" ID="LinkButton10" Visible='<%#Eval("Status").Equals("No") ? true : false %>'
                                            OnClientClick="return confirm('Do you want to make this Directorate active?');"
                                            CommandName="update"><%#Eval("DirectorateName") %></asp:LinkButton>
                                    </td>
                                    <td>
                                        <%#Eval("AddressLine1") %>
                                    </td>
                                    <td>
                                        <%#Eval("Postcode") %>
                                    </td>
                                    <td>
                                        <%#Eval("ContactName") %>
                                    </td>
                                    <td>
                                        <%#Eval("Status") %>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
        </div>
        <div id="table_footer" class="dtBottom">
            <div id="table_paging" class="dtPagination">
                <CC:CollectionPager runat="server" ID="CollectionPager1" BackText="Back" FirstText="First"
                    ShowLabel="True" ShowFirstLast="False" NextText="Next" ResultsLocation="None"
                    PageNumbersSeparator=" " HideOnSinglePage="False" PagingMode="PostBack" />
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
